/*
* Copyrigth 2008 Company All rigths reserved
* File Name: ILaboratory.cs
* Created By:    Wenbin.Xu
* Created Date:   2013/7/8 16:34:52
* Description:    Laboratory模块的接口
* Change History: 
* 
* */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TrainingsApp.Model;
using TrainingsApp.DAL;
using System.Web.UI.WebControls;

namespace TrainingsApp.Logic {
    public class TS_User_Teacher_Logic {
        public static TS_User_Teacher_Collecion TS_User_Teacher_ListByPaging(int pageSize, int pageIndex) {
            return TS_User_Teacher_DAL.TS_User_Teacher_ListByPaging(pageSize, pageIndex);
        }

        public static TS_User_Teacher_Collecion TS_User_Children_ListToGridByPaging(int pageSize, int pageIndex, System.Collections.Specialized.StringDictionary dict) {
            string where = WhereHelper.ConvertToAndSQL(dict);
            return TS_User_Teacher_DAL.TS_User_Teacher_ListToGridByPaging(pageSize, pageIndex, where);
        }


        //public static TS_User_Teacher_Entity TS_User_Teacher_View(System.Int64 UserId, System.Int64 SchoolId, System.Int64 ClassesId) {
        //    return TS_User_Teacher_DAL.TS_User_Teacher_View(UserId, SchoolId, ClassesId);
        //}

        public static List<TS_User_Teacher_Entity> TS_User_Teacher_View(Int64 UserId) {
            return TS_User_Teacher_DAL.TS_User_Teacher_View(UserId);
        }

        public static List<TS_User_Teacher_Entity> TS_User_Teacher_ViewAllClass(Int64 UserId) {
            return TS_User_Teacher_DAL.TS_User_Teacher_ViewAllClass(UserId);
        }


        //public static TS_User_Teacher_Entity TS_User_Teacher_Add(TS_User_Teacher_Entity entity) {
        //    return TS_User_Teacher_DAL.TS_User_Teacher_Add(entity);
        //}

        public static TS_User_Teacher_Entity TS_User_Teacher_Add(List<TS_User_Teacher_Entity> entities) {
            var addEntity = TS_User_Teacher_DAL.TS_User_Teacher_Add(entities);


            TrainingsApp.Logic.Sys_Permission_Logic.T_USER_Role_Update(addEntity.UserId.Value, new List<TS_USER_ROLE_Entity> { 
                 new TS_USER_ROLE_Entity{
                  ROLEID =(int) UserType.Teacher,
                   USERID = (int)addEntity.UserId.Value
                 }
                });
            return addEntity;
        }

        public static void TS_User_Teacher_Update(List<TS_User_Teacher_Entity> entities) {
            TS_User_Teacher_DAL.TS_User_Teacher_Update(entities);
        }

        public static void TS_User_Teacher_Delete(System.Int64 UserId, System.Int64 SchoolId, System.Int64 ClassesId) {
            TS_User_Teacher_DAL.TS_User_Teacher_Delete(UserId, SchoolId, ClassesId);
        }


    }
}
